<template>
  <div>
    <!-- 表头 -->
    <el-page-header @back="goBack" :content="content"> </el-page-header>
    <!-- 表单 -->
   
    <el-form size="small" ref="form" :model="form" label-width="80px">
      <el-form-item label="标题">
        <el-input v-model="form.title"></el-input>
      </el-form-item>
      <el-form-item label="摘要">
        <el-input v-model="form.brief"></el-input>
      </el-form-item>
      <!-- <el-form-item label="内容">
      <el-input v-model="form.content"></el-input>
      </el-form-item> -->
      <el-form-item label="内容">
      <el-input
        type="textarea"
        :autosize="{ minRows: 2, maxRows: 80}"
        placeholder="请输入内容"
        v-model="form.content">
      </el-input>
      </el-form-item>
      
      <el-form-item label="发布时间">
        <el-input v-model="form.publishTime"></el-input>
      </el-form-item>
      <el-form-item label="阅读时长（分钟）">
        <el-input v-model="form.readTimes"></el-input>
      </el-form-item>
      <el-form-item label="状态">
        <el-input v-model="form.status"></el-input>
      </el-form-item>
     
       <el-form-item label="来源">
        <el-input v-model="form.cover"></el-input>
      </el-form-item>
      <!-- <el-form-item label="作者">
        <el-input v-model="form.authorId"></el-input>
      </el-form-item> -->
      <el-form-item label="类别">
        <el-input v-model="form.categoryId"></el-input>
      </el-form-item>
      <el-form-item>
        <div style="text-align:right">
          <el-button type="primary" @click="submitHandler">提交</el-button>
        </div>
      </el-form-item>
    </el-form>


  </div>
</template>


<script>
import { post } from '@/utils/request'
export default {
  data(){
    return {
      content:"新增文章管理信息",
      form:{}
    }
  },
  methods:{
    // 提交
    submitHandler(){
      let url = "http://localhost:8888/article/saveOrUpdate"
      post(url,this.form).then(resp =>{
        // 提示
        this.$message({type:"success",message:resp.message})
        // 返回列表页面
        this.goBack();
      })
    },
    // 返回
    goBack(){
      this.$router.go(-1)
    }
  },
  created(){
    // 页面加载出来的时候，将路由中的参数拿到，放到this.form 中
    this.form = this.$route.query;
  }

}
</script>
<style lang="sass" scoped>

</style>